//
//  ViewController.m
//  MJVideoPlayer
//
//  Created by 梅杰 on 16/8/12.
//  Copyright © 2016年 梅杰. All rights reserved.
//

#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>
#import <Photos/Photos.h>
#import "UIImage+MJPlayer.h"
//#import "VideoPlayer.h"
#import <MobileVLCKit/MobileVLCKit.h>
@interface ViewController () <VLCMediaPlayerDelegate>
@property (weak, nonatomic) IBOutlet UIImageView *testImageView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
//    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
//    [self.view addSubview:imageView];
    [self setMediaPalyer];
}

- (void) setMediaPalyer{
    
    
//    NSString *path = [[NSBundle mainBundle] pathForResource:@"test.mp4" ofType:nil];
//    NSURL *url = [NSURL fileURLWithPath:path];
//    ((UIImageView *)self.view.subviews.lastObject).image = [UIImage thumbnailImageForVideo:url];
////    NSString *d = NSStringFromClass(self.view.subviews.firstObject.class);
//    //创建
//    
////    PHAsset *phsset = [[PHAsset alloc] init];
//    
////    AVAsset *ss = [AVAsset assetWithURL:url];
//    AVAsset *movieAsset = [AVURLAsset URLAssetWithURL:url options:nil];
//    AVPlayerItem *playItem = [AVPlayerItem playerItemWithAsset:movieAsset];
//    
//    AVPlayer *player = [[AVPlayer alloc] initWithPlayerItem:playItem];
//    
//    AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:player];
//    playerLayer.videoGravity = AVLayerVideoGravityResizeAspect;
//    playerLayer.frame = self.view.bounds;
//    
//    [self.view.layer addSublayer:playerLayer];
//    [player play];
//    NSURL *url1 = [NSURL URLWithString:@"http://www.yinyuetai.com/mv/video-url/2104967"];
//    VideoPlayer *v = [VideoPlayer VideoPlayerWith:url1 andType:VLCPLAYER];
//    v.viewController = self;
//    v.backgroundColor = [UIColor redColor];
//    [self.view addSubview:v];
//    [v VLCPlay];
    
//    VLCMedia *media = [VLCMedia mediaWithURL:url1];

//    self.testImageView.image = [UIImage thumbnailImageForVideo:url1];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
